import request from '@/utils/request'

const api = {
  getGytzPageUrl: '/mes_gytz/get_gytz_page',
  addGytzUrl: '/mes_gytz/add_gytz',
  editGytzUrl: '/mes_gytz/edit_gytz',
  removeGytzUrl: '/mes_gytz/remove_gytz',
  uploadFileUrl: '/mes_gytz/upload_file',
}

// 文件上传接口
export async function uploadFileApi<T>(data: any) {
  const res = await request({
    url: api.uploadFileUrl,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    method: 'post',
    data,
  })
  return res as unknown as resultType<T>
}

export async function removeGytzApi(params: Map<string, any>) {
  const res = await request({
    url: api.removeGytzUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function editGytzApi(params: Map<string, any>) {
  const res = await request({
    url: api.editGytzUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function addGytzApi(params: Map<string, any>) {
  const res = await request({
    url: api.addGytzUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function getGytzPageApi(params: Map<string, any>) {
  const res = await request({
    url: api.getGytzPageUrl,
    method: 'post',
    data: params,
  })
  return res
}
